int sensor_pin = 14;
int cnt=0;
long timer=0;
void setup(){
  Serial.begin(9600);   //设置串口通信频率
  pinMode(sensor_pin,INPUT);    //设置为输入模式
  attachInterrupt(sensor_pin,bodycnt,RISING);
}

ICACHE_RAM_ATTR void bodycnt()
{
  cnt++;
}

void loop(){
  if(millis()-timer>=1000)
  {
    timer=millis();
    Serial.println("cnt=");  
    Serial.println(cnt);    
    cnt=0;
  }
}
